package org.example.lambda;

import java.util.function.Function;

public class Main {
    public static void main(String[] args) {
        int result = method(nums->{
            int max = Integer.MIN_VALUE;
            for(int num:nums){
                max = Math.max(num,max);
            }
            return max;
        },new int[]{4,2,7});
        System.out.println(result);
    }
    //传递一个数组，找出这个数组的最大值进行返回
    static int method(Function<int[],Integer> function,int[] nums){
        return function.apply(nums);
    }
}
